﻿namespace Sidvall.WorkItemManager.Net.Services.V1
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
    public sealed partial class WorkItem : global::Sidvall.Data.ServiceDataRowBase, global::Sidvall.WorkItemManager.Data.IWorkItem
    {
        #region Public Members

        #region CanceledAction

        private global::Sidvall.WorkItemManager.Workflow.ThreadAction _CanceledAction;
        partial void OnBeforeCanceledActionPropertyChanged(Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.ThreadAction> eventData);
        partial void OnAfterCanceledActionPropertyChanged();
        public global::Sidvall.WorkItemManager.Workflow.ThreadAction CanceledAction
        { 
            get
            {
                return _CanceledAction;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _CanceledAction = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.ThreadAction> eventData = new Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.ThreadAction>(value, _CanceledAction);
                    OnBeforeCanceledActionPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("CanceledAction", eventData.Value, true, true);
                        OnAfterCanceledActionPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region Description

        private string _Description;
        partial void OnBeforeDescriptionPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterDescriptionPropertyChanged();
        public string Description
        { 
            get
            {
                return _Description;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _Description = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _Description);
                    OnBeforeDescriptionPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("Description", eventData.Value, true, true);
                        OnAfterDescriptionPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ExecutionCompletionPercentage

        private byte _ExecutionCompletionPercentage;
        partial void OnBeforeExecutionCompletionPercentagePropertyChanged(Sidvall.Business.PropertyChangeEventData<byte> eventData);
        partial void OnAfterExecutionCompletionPercentagePropertyChanged();
        public byte ExecutionCompletionPercentage
        { 
            get
            {
                return _ExecutionCompletionPercentage;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ExecutionCompletionPercentage = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<byte> eventData = new Sidvall.Business.PropertyChangeEventData<byte>(value, _ExecutionCompletionPercentage);
                    OnBeforeExecutionCompletionPercentagePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ExecutionCompletionPercentage", eventData.Value, true, true);
                        OnAfterExecutionCompletionPercentagePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ExecutionContext

        private string _ExecutionContext;
        partial void OnBeforeExecutionContextPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterExecutionContextPropertyChanged();
        public string ExecutionContext
        { 
            get
            {
                return _ExecutionContext;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ExecutionContext = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _ExecutionContext);
                    OnBeforeExecutionContextPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ExecutionContext", eventData.Value, true, true);
                        OnAfterExecutionContextPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ExecutionContextUpdated

        private System.Nullable<System.DateTime> _ExecutionContextUpdated;
        partial void OnBeforeExecutionContextUpdatedPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData);
        partial void OnAfterExecutionContextUpdatedPropertyChanged();
        public System.Nullable<System.DateTime> ExecutionContextUpdated
        { 
            get
            {
                return _ExecutionContextUpdated;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ExecutionContextUpdated = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>>(value, _ExecutionContextUpdated);
                    OnBeforeExecutionContextUpdatedPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ExecutionContextUpdated", eventData.Value, true, true);
                        OnAfterExecutionContextUpdatedPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ExecutionOrder

        private int _ExecutionOrder;
        partial void OnBeforeExecutionOrderPropertyChanged(Sidvall.Business.PropertyChangeEventData<int> eventData);
        partial void OnAfterExecutionOrderPropertyChanged();
        public int ExecutionOrder
        { 
            get
            {
                return _ExecutionOrder;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ExecutionOrder = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<int> eventData = new Sidvall.Business.PropertyChangeEventData<int>(value, _ExecutionOrder);
                    OnBeforeExecutionOrderPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ExecutionOrder", eventData.Value, true, true);
                        OnAfterExecutionOrderPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ExecutionStartTime

        private System.Nullable<System.DateTime> _ExecutionStartTime;
        partial void OnBeforeExecutionStartTimePropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData);
        partial void OnAfterExecutionStartTimePropertyChanged();
        public System.Nullable<System.DateTime> ExecutionStartTime
        { 
            get
            {
                return _ExecutionStartTime;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ExecutionStartTime = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>>(value, _ExecutionStartTime);
                    OnBeforeExecutionStartTimePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ExecutionStartTime", eventData.Value, true, true);
                        OnAfterExecutionStartTimePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region FailedAction

        private global::Sidvall.WorkItemManager.Workflow.ThreadAction _FailedAction;
        partial void OnBeforeFailedActionPropertyChanged(Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.ThreadAction> eventData);
        partial void OnAfterFailedActionPropertyChanged();
        public global::Sidvall.WorkItemManager.Workflow.ThreadAction FailedAction
        { 
            get
            {
                return _FailedAction;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _FailedAction = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.ThreadAction> eventData = new Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.ThreadAction>(value, _FailedAction);
                    OnBeforeFailedActionPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("FailedAction", eventData.Value, true, true);
                        OnAfterFailedActionPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region FailedExecutionCount

        private int _FailedExecutionCount;
        partial void OnBeforeFailedExecutionCountPropertyChanged(Sidvall.Business.PropertyChangeEventData<int> eventData);
        partial void OnAfterFailedExecutionCountPropertyChanged();
        public int FailedExecutionCount
        { 
            get
            {
                return _FailedExecutionCount;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _FailedExecutionCount = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<int> eventData = new Sidvall.Business.PropertyChangeEventData<int>(value, _FailedExecutionCount);
                    OnBeforeFailedExecutionCountPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("FailedExecutionCount", eventData.Value, true, true);
                        OnAfterFailedExecutionCountPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ForceExecution

        private bool _ForceExecution;
        partial void OnBeforeForceExecutionPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterForceExecutionPropertyChanged();
        public bool ForceExecution
        { 
            get
            {
                return _ForceExecution;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ForceExecution = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _ForceExecution);
                    OnBeforeForceExecutionPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ForceExecution", eventData.Value, true, true);
                        OnAfterForceExecutionPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region IsCanceled

        private bool _IsCanceled;
        partial void OnBeforeIsCanceledPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterIsCanceledPropertyChanged();
        public bool IsCanceled
        { 
            get
            {
                return _IsCanceled;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _IsCanceled = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _IsCanceled);
                    OnBeforeIsCanceledPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("IsCanceled", eventData.Value, true, true);
                        OnAfterIsCanceledPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region IsEnabled

        private bool _IsEnabled;
        partial void OnBeforeIsEnabledPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterIsEnabledPropertyChanged();
        public bool IsEnabled
        { 
            get
            {
                return _IsEnabled;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _IsEnabled = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _IsEnabled);
                    OnBeforeIsEnabledPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("IsEnabled", eventData.Value, true, true);
                        OnAfterIsEnabledPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region LastExecutionEndTime

        private System.Nullable<System.DateTime> _LastExecutionEndTime;
        partial void OnBeforeLastExecutionEndTimePropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData);
        partial void OnAfterLastExecutionEndTimePropertyChanged();
        public System.Nullable<System.DateTime> LastExecutionEndTime
        { 
            get
            {
                return _LastExecutionEndTime;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _LastExecutionEndTime = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>>(value, _LastExecutionEndTime);
                    OnBeforeLastExecutionEndTimePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("LastExecutionEndTime", eventData.Value, true, true);
                        OnAfterLastExecutionEndTimePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region LastExecutionStartTime

        private System.Nullable<System.DateTime> _LastExecutionStartTime;
        partial void OnBeforeLastExecutionStartTimePropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData);
        partial void OnAfterLastExecutionStartTimePropertyChanged();
        public System.Nullable<System.DateTime> LastExecutionStartTime
        { 
            get
            {
                return _LastExecutionStartTime;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _LastExecutionStartTime = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>>(value, _LastExecutionStartTime);
                    OnBeforeLastExecutionStartTimePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("LastExecutionStartTime", eventData.Value, true, true);
                        OnAfterLastExecutionStartTimePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region LastResultMessage

        private string _LastResultMessage;
        partial void OnBeforeLastResultMessagePropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterLastResultMessagePropertyChanged();
        public string LastResultMessage
        { 
            get
            {
                return _LastResultMessage;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _LastResultMessage = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _LastResultMessage);
                    OnBeforeLastResultMessagePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("LastResultMessage", eventData.Value, true, true);
                        OnAfterLastResultMessagePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region LastWorkItemResultId

        private System.Nullable<global::Sidvall.WorkItemManager.Workflow.WorkItemResultType> _LastWorkItemResultId;
        partial void OnBeforeLastWorkItemResultIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<global::Sidvall.WorkItemManager.Workflow.WorkItemResultType>> eventData);
        partial void OnAfterLastWorkItemResultIdPropertyChanged();
        public System.Nullable<global::Sidvall.WorkItemManager.Workflow.WorkItemResultType> LastWorkItemResultId
        { 
            get
            {
                return _LastWorkItemResultId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _LastWorkItemResultId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<global::Sidvall.WorkItemManager.Workflow.WorkItemResultType>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<global::Sidvall.WorkItemManager.Workflow.WorkItemResultType>>(value, _LastWorkItemResultId);
                    OnBeforeLastWorkItemResultIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("LastWorkItemResultId", eventData.Value, true, true);
                        OnAfterLastWorkItemResultIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region LogDayCount

        private int _LogDayCount;
        partial void OnBeforeLogDayCountPropertyChanged(Sidvall.Business.PropertyChangeEventData<int> eventData);
        partial void OnAfterLogDayCountPropertyChanged();
        public int LogDayCount
        { 
            get
            {
                return _LogDayCount;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _LogDayCount = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<int> eventData = new Sidvall.Business.PropertyChangeEventData<int>(value, _LogDayCount);
                    OnBeforeLogDayCountPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("LogDayCount", eventData.Value, true, true);
                        OnAfterLogDayCountPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region LogModeId

        private global::Sidvall.WorkItemManager.Workflow.LogModes _LogModeId;
        partial void OnBeforeLogModeIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.LogModes> eventData);
        partial void OnAfterLogModeIdPropertyChanged();
        public global::Sidvall.WorkItemManager.Workflow.LogModes LogModeId
        { 
            get
            {
                return _LogModeId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _LogModeId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.LogModes> eventData = new Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.LogModes>(value, _LogModeId);
                    OnBeforeLogModeIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("LogModeId", eventData.Value, true, true);
                        OnAfterLogModeIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region Name

        private string _Name;
        partial void OnBeforeNamePropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterNamePropertyChanged();
        public string Name
        { 
            get
            {
                return _Name;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _Name = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _Name);
                    OnBeforeNamePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("Name", eventData.Value, true, true);
                        OnAfterNamePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region RetryCount

        private int _RetryCount;
        partial void OnBeforeRetryCountPropertyChanged(Sidvall.Business.PropertyChangeEventData<int> eventData);
        partial void OnAfterRetryCountPropertyChanged();
        public int RetryCount
        { 
            get
            {
                return _RetryCount;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _RetryCount = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<int> eventData = new Sidvall.Business.PropertyChangeEventData<int>(value, _RetryCount);
                    OnBeforeRetryCountPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("RetryCount", eventData.Value, true, true);
                        OnAfterRetryCountPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region RetryTime

        private System.Nullable<System.DateTime> _RetryTime;
        partial void OnBeforeRetryTimePropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData);
        partial void OnAfterRetryTimePropertyChanged();
        public System.Nullable<System.DateTime> RetryTime
        { 
            get
            {
                return _RetryTime;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _RetryTime = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<System.DateTime>>(value, _RetryTime);
                    OnBeforeRetryTimePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("RetryTime", eventData.Value, true, true);
                        OnAfterRetryTimePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region SensorLogDayCount

        private int _SensorLogDayCount;
        partial void OnBeforeSensorLogDayCountPropertyChanged(Sidvall.Business.PropertyChangeEventData<int> eventData);
        partial void OnAfterSensorLogDayCountPropertyChanged();
        public int SensorLogDayCount
        { 
            get
            {
                return _SensorLogDayCount;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _SensorLogDayCount = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<int> eventData = new Sidvall.Business.PropertyChangeEventData<int>(value, _SensorLogDayCount);
                    OnBeforeSensorLogDayCountPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("SensorLogDayCount", eventData.Value, true, true);
                        OnAfterSensorLogDayCountPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region WorkerId

        private long _WorkerId;
        partial void OnBeforeWorkerIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<long> eventData);
        partial void OnAfterWorkerIdPropertyChanged();
        public long WorkerId
        { 
            get
            {
                return _WorkerId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _WorkerId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<long> eventData = new Sidvall.Business.PropertyChangeEventData<long>(value, _WorkerId);
                    OnBeforeWorkerIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("WorkerId", eventData.Value, true, true);
                        OnAfterWorkerIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region WorkItemContext

        private string _WorkItemContext;
        partial void OnBeforeWorkItemContextPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterWorkItemContextPropertyChanged();
        public string WorkItemContext
        { 
            get
            {
                return _WorkItemContext;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _WorkItemContext = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _WorkItemContext);
                    OnBeforeWorkItemContextPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("WorkItemContext", eventData.Value, true, true);
                        OnAfterWorkItemContextPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region WorkItemId

        private System.Nullable<long> _WorkItemId;
        partial void OnBeforeWorkItemIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<long>> eventData);
        partial void OnAfterWorkItemIdPropertyChanged();
        public System.Nullable<long> WorkItemId
        { 
            get
            {
                return _WorkItemId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _WorkItemId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<long>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<long>>(value, _WorkItemId);
                    OnBeforeWorkItemIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("WorkItemId", eventData.Value, true, true);
                        OnAfterWorkItemIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region WorkItemStatusId

        private global::Sidvall.WorkItemManager.Workflow.WorkItemStatus _WorkItemStatusId;
        partial void OnBeforeWorkItemStatusIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.WorkItemStatus> eventData);
        partial void OnAfterWorkItemStatusIdPropertyChanged();
        public global::Sidvall.WorkItemManager.Workflow.WorkItemStatus WorkItemStatusId
        { 
            get
            {
                return _WorkItemStatusId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _WorkItemStatusId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.WorkItemStatus> eventData = new Sidvall.Business.PropertyChangeEventData<global::Sidvall.WorkItemManager.Workflow.WorkItemStatus>(value, _WorkItemStatusId);
                    OnBeforeWorkItemStatusIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("WorkItemStatusId", eventData.Value, true, true);
                        OnAfterWorkItemStatusIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region WorkItemTypeId

        private System.Nullable<long> _WorkItemTypeId;
        partial void OnBeforeWorkItemTypeIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<long>> eventData);
        partial void OnAfterWorkItemTypeIdPropertyChanged();
        public System.Nullable<long> WorkItemTypeId
        { 
            get
            {
                return _WorkItemTypeId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _WorkItemTypeId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<long>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<long>>(value, _WorkItemTypeId);
                    OnBeforeWorkItemTypeIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("WorkItemTypeId", eventData.Value, true, true);
                        OnAfterWorkItemTypeIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region WorkRetryPolicyContext

        private string _WorkRetryPolicyContext;
        partial void OnBeforeWorkRetryPolicyContextPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterWorkRetryPolicyContextPropertyChanged();
        public string WorkRetryPolicyContext
        { 
            get
            {
                return _WorkRetryPolicyContext;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _WorkRetryPolicyContext = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _WorkRetryPolicyContext);
                    OnBeforeWorkRetryPolicyContextPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("WorkRetryPolicyContext", eventData.Value, true, true);
                        OnAfterWorkRetryPolicyContextPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region WorkRetryPolicyId

        private System.Nullable<long> _WorkRetryPolicyId;
        partial void OnBeforeWorkRetryPolicyIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<long>> eventData);
        partial void OnAfterWorkRetryPolicyIdPropertyChanged();
        public System.Nullable<long> WorkRetryPolicyId
        { 
            get
            {
                return _WorkRetryPolicyId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _WorkRetryPolicyId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<long>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<long>>(value, _WorkRetryPolicyId);
                    OnBeforeWorkRetryPolicyIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("WorkRetryPolicyId", eventData.Value, true, true);
                        OnAfterWorkRetryPolicyIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ServerConnectionId

        private System.Nullable<System.Int32> _ServerConnectionId;
        partial void OnBeforeServerConnectionIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<System.Int32>> eventData);
        partial void OnAfterServerConnectionIdPropertyChanged();
        public System.Nullable<System.Int32> ServerConnectionId
        { 
            get
            {
                return _ServerConnectionId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ServerConnectionId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<System.Int32>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<System.Int32>>(value, _ServerConnectionId);
                    OnBeforeServerConnectionIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ServerConnectionId", eventData.Value, true, true);
                        OnAfterServerConnectionIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.DataRowStateIsDirty(this);
            }
        }

        #endregion
        
        public Worker Worker { get; set; }
        public WorkItemType WorkItemType { get; set; }
        public WorkRetryPolicy WorkRetryPolicy { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public WorkItemLogCollectionItem WorkItemLogs { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public WorkItemSensorCollectionItem WorkItemSensors { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public WorkItemWorkConditionCollectionItem WorkItemWorkConditions { get; set; }
        #region LoadWorkItemLogs

        public void LoadWorkItemLogs(WorkItemLogCollectionItem value)
        {
            LoadInstanceField("WorkItemLogs", value, true, false);
        }

        #endregion
        #region LoadWorkItemSensors

        public void LoadWorkItemSensors(WorkItemSensorCollectionItem value)
        {
            LoadInstanceField("WorkItemSensors", value, true, false);
        }

        #endregion
        #region LoadWorkItemWorkConditions

        public void LoadWorkItemWorkConditions(WorkItemWorkConditionCollectionItem value)
        {
            LoadInstanceField("WorkItemWorkConditions", value, true, false);
        }

        #endregion
        #region LoadWorkItemLogsAsync

        public async System.Threading.Tasks.Task<WorkItemLogCollectionItem> LoadWorkItemLogsAsync()
        {
            return await LoadWorkItemLogsAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<WorkItemLogCollectionItem> LoadWorkItemLogsAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchListCriteria<global::Sidvall.WorkItemManager.Data.Fields.WorkItemLogField, global::Sidvall.WorkItemManager.Data.Relations.WorkItemLogRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.LoadWorkItemLogsAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.WorkItemLogs;
        }

        #endregion
        #region LoadWorkItemSensorsAsync

        public async System.Threading.Tasks.Task<WorkItemSensorCollectionItem> LoadWorkItemSensorsAsync()
        {
            return await LoadWorkItemSensorsAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<WorkItemSensorCollectionItem> LoadWorkItemSensorsAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchListCriteria<global::Sidvall.WorkItemManager.Data.Fields.WorkItemSensorField, global::Sidvall.WorkItemManager.Data.Relations.WorkItemSensorRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.LoadWorkItemSensorsAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.WorkItemSensors;
        }

        #endregion
        #region LoadWorkItemWorkConditionsAsync

        public async System.Threading.Tasks.Task<WorkItemWorkConditionCollectionItem> LoadWorkItemWorkConditionsAsync()
        {
            return await LoadWorkItemWorkConditionsAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<WorkItemWorkConditionCollectionItem> LoadWorkItemWorkConditionsAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchListCriteria<global::Sidvall.WorkItemManager.Data.Fields.WorkItemWorkConditionField, global::Sidvall.WorkItemManager.Data.Relations.WorkItemWorkConditionRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.LoadWorkItemWorkConditionsAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.WorkItemWorkConditions;
        }

        #endregion
        #region LoadWorkerAsync

        public async System.Threading.Tasks.Task<Worker> LoadWorkerAsync()
        {
            return await LoadWorkerAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<Worker> LoadWorkerAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchCriteria<global::Sidvall.WorkItemManager.Data.Fields.WorkerField, global::Sidvall.WorkItemManager.Data.Relations.WorkerRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.LoadWorkerAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.Worker;
        }
        public Worker LoadWorker(Worker item)
        {
            LoadInstanceField("Worker", item, true, false);
            return item;
        }

        #endregion
        #region LoadWorkItemTypeAsync

        public async System.Threading.Tasks.Task<WorkItemType> LoadWorkItemTypeAsync()
        {
            return await LoadWorkItemTypeAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<WorkItemType> LoadWorkItemTypeAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchCriteria<global::Sidvall.WorkItemManager.Data.Fields.WorkItemTypeField, global::Sidvall.WorkItemManager.Data.Relations.WorkItemTypeRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.LoadWorkItemTypeAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.WorkItemType;
        }
        public WorkItemType LoadWorkItemType(WorkItemType item)
        {
            LoadInstanceField("WorkItemType", item, true, false);
            return item;
        }

        #endregion
        #region LoadWorkRetryPolicyAsync

        public async System.Threading.Tasks.Task<WorkRetryPolicy> LoadWorkRetryPolicyAsync()
        {
            return await LoadWorkRetryPolicyAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<WorkRetryPolicy> LoadWorkRetryPolicyAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchCriteria<global::Sidvall.WorkItemManager.Data.Fields.WorkRetryPolicyField, global::Sidvall.WorkItemManager.Data.Relations.WorkRetryPolicyRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.LoadWorkRetryPolicyAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.WorkRetryPolicy;
        }
        public WorkRetryPolicy LoadWorkRetryPolicy(WorkRetryPolicy item)
        {
            LoadInstanceField("WorkRetryPolicy", item, true, false);
            return item;
        }

        #endregion
        #region LoadInstanceField

        public void LoadInstanceField(string fieldName, object value, bool cascade, bool updateState)
        {
            global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.LoadInstanceField(this, fieldName, value, cascade, false, updateState);
        }

        #endregion
        #region Copy

        public WorkItem Copy()
        {
            return global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.Copy(this);
        }
        public WorkItem Copy(Sidvall.Data.CopySettings settings)
        {
            return global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.Copy(this, settings);
        }

        #endregion
        #region Import

        public void Import(global::Sidvall.WorkItemManager.Data.IWorkItem item)
        {
            global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.Import(this, item);
        }
        public void Import(global::Sidvall.WorkItemManager.Data.IWorkItem item, Sidvall.Data.CopySettings settings)
        {
            global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.Import(this, item, settings);
        }

        #endregion
        #region SaveItemAsync

        public async System.Threading.Tasks.Task<WorkItem> SaveItemAsync()
        {
            return await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.SaveItemAsync(this).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<WorkItem> SaveItemAsync(Sidvall.Data.SaveMode mode)
        {
            return await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.SaveItemAsync(this, mode).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<WorkItem> SaveItemAsync(Sidvall.Data.SaveSettings settings)
        {
            return await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.SaveItemAsync(this, settings).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<WorkItem> SaveItemAsync(Sidvall.Data.SaveSettings settings, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            return await global::Sidvall.WorkItemManager.SystemContext.Current.DataPortal.WorkItemManager.SaveItemAsync(this, settings, strategyContext, objectParameters).ConfigureAwait(false);
        }

        #endregion
        #region ValidateAsync

        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync()
        {
            return await global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.ValidateAsync(this).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync(Sidvall.Data.ValidationSettings settings)
        {
            return await global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.ValidateAsync(this, settings).ConfigureAwait(false);
        }

        #endregion
        #region Initialize

        public void Initialize()
        {
            global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.Initialize(this);
        }
        public void Initialize(Sidvall.Data.InitializeSettings settings)
        {
            global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.Initialize(this, settings);
        }

        #endregion

        #region IWorkItem Members

        global::Sidvall.WorkItemManager.Workflow.ThreadAction global::Sidvall.WorkItemManager.Data.IWorkItem.CanceledAction
        {
            get
            {
                return this._CanceledAction;
            }
            set
            {
                this._CanceledAction = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItem.Description
        {
            get
            {
                return this._Description;
            }
            set
            {
                this._Description = value;
            }
        }
        byte global::Sidvall.WorkItemManager.Data.IWorkItem.ExecutionCompletionPercentage
        {
            get
            {
                return this._ExecutionCompletionPercentage;
            }
            set
            {
                this._ExecutionCompletionPercentage = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItem.ExecutionContext
        {
            get
            {
                return this._ExecutionContext;
            }
            set
            {
                this._ExecutionContext = value;
            }
        }
        System.Nullable<System.DateTime> global::Sidvall.WorkItemManager.Data.IWorkItem.ExecutionContextUpdated
        {
            get
            {
                return this._ExecutionContextUpdated;
            }
            set
            {
                this._ExecutionContextUpdated = value;
            }
        }
        int global::Sidvall.WorkItemManager.Data.IWorkItem.ExecutionOrder
        {
            get
            {
                return this._ExecutionOrder;
            }
            set
            {
                this._ExecutionOrder = value;
            }
        }
        System.Nullable<System.DateTime> global::Sidvall.WorkItemManager.Data.IWorkItem.ExecutionStartTime
        {
            get
            {
                return this._ExecutionStartTime;
            }
            set
            {
                this._ExecutionStartTime = value;
            }
        }
        global::Sidvall.WorkItemManager.Workflow.ThreadAction global::Sidvall.WorkItemManager.Data.IWorkItem.FailedAction
        {
            get
            {
                return this._FailedAction;
            }
            set
            {
                this._FailedAction = value;
            }
        }
        int global::Sidvall.WorkItemManager.Data.IWorkItem.FailedExecutionCount
        {
            get
            {
                return this._FailedExecutionCount;
            }
            set
            {
                this._FailedExecutionCount = value;
            }
        }
        bool global::Sidvall.WorkItemManager.Data.IWorkItem.ForceExecution
        {
            get
            {
                return this._ForceExecution;
            }
            set
            {
                this._ForceExecution = value;
            }
        }
        bool global::Sidvall.WorkItemManager.Data.IWorkItem.IsCanceled
        {
            get
            {
                return this._IsCanceled;
            }
            set
            {
                this._IsCanceled = value;
            }
        }
        bool global::Sidvall.WorkItemManager.Data.IWorkItem.IsEnabled
        {
            get
            {
                return this._IsEnabled;
            }
            set
            {
                this._IsEnabled = value;
            }
        }
        System.Nullable<System.DateTime> global::Sidvall.WorkItemManager.Data.IWorkItem.LastExecutionEndTime
        {
            get
            {
                return this._LastExecutionEndTime;
            }
            set
            {
                this._LastExecutionEndTime = value;
            }
        }
        System.Nullable<System.DateTime> global::Sidvall.WorkItemManager.Data.IWorkItem.LastExecutionStartTime
        {
            get
            {
                return this._LastExecutionStartTime;
            }
            set
            {
                this._LastExecutionStartTime = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItem.LastResultMessage
        {
            get
            {
                return this._LastResultMessage;
            }
            set
            {
                this._LastResultMessage = value;
            }
        }
        System.Nullable<global::Sidvall.WorkItemManager.Workflow.WorkItemResultType> global::Sidvall.WorkItemManager.Data.IWorkItem.LastWorkItemResultId
        {
            get
            {
                return this._LastWorkItemResultId;
            }
            set
            {
                this._LastWorkItemResultId = value;
            }
        }
        int global::Sidvall.WorkItemManager.Data.IWorkItem.LogDayCount
        {
            get
            {
                return this._LogDayCount;
            }
            set
            {
                this._LogDayCount = value;
            }
        }
        global::Sidvall.WorkItemManager.Workflow.LogModes global::Sidvall.WorkItemManager.Data.IWorkItem.LogModeId
        {
            get
            {
                return this._LogModeId;
            }
            set
            {
                this._LogModeId = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItem.Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                this._Name = value;
            }
        }
        int global::Sidvall.WorkItemManager.Data.IWorkItem.RetryCount
        {
            get
            {
                return this._RetryCount;
            }
            set
            {
                this._RetryCount = value;
            }
        }
        System.Nullable<System.DateTime> global::Sidvall.WorkItemManager.Data.IWorkItem.RetryTime
        {
            get
            {
                return this._RetryTime;
            }
            set
            {
                this._RetryTime = value;
            }
        }
        int global::Sidvall.WorkItemManager.Data.IWorkItem.SensorLogDayCount
        {
            get
            {
                return this._SensorLogDayCount;
            }
            set
            {
                this._SensorLogDayCount = value;
            }
        }
        long global::Sidvall.WorkItemManager.Data.IWorkItem.WorkerId
        {
            get
            {
                return this._WorkerId;
            }
            set
            {
                this._WorkerId = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItem.WorkItemContext
        {
            get
            {
                return this._WorkItemContext;
            }
            set
            {
                this._WorkItemContext = value;
            }
        }
        System.Nullable<long> global::Sidvall.WorkItemManager.Data.IWorkItem.WorkItemId
        {
            get
            {
                return this._WorkItemId;
            }
            set
            {
                this._WorkItemId = value;
            }
        }
        global::Sidvall.WorkItemManager.Workflow.WorkItemStatus global::Sidvall.WorkItemManager.Data.IWorkItem.WorkItemStatusId
        {
            get
            {
                return this._WorkItemStatusId;
            }
            set
            {
                this._WorkItemStatusId = value;
            }
        }
        System.Nullable<long> global::Sidvall.WorkItemManager.Data.IWorkItem.WorkItemTypeId
        {
            get
            {
                return this._WorkItemTypeId;
            }
            set
            {
                this._WorkItemTypeId = value;
            }
        }
        string global::Sidvall.WorkItemManager.Data.IWorkItem.WorkRetryPolicyContext
        {
            get
            {
                return this._WorkRetryPolicyContext;
            }
            set
            {
                this._WorkRetryPolicyContext = value;
            }
        }
        System.Nullable<long> global::Sidvall.WorkItemManager.Data.IWorkItem.WorkRetryPolicyId
        {
            get
            {
                return this._WorkRetryPolicyId;
            }
            set
            {
                this._WorkRetryPolicyId = value;
            }
        }
        System.Nullable<System.Int32> global::Sidvall.WorkItemManager.Data.IWorkItem.ServerConnectionId
        {
            get
            {
                return this._ServerConnectionId;
            }
            set
            {
                this._ServerConnectionId = value;
            }
        }
        global::Sidvall.WorkItemManager.Data.IWorker global::Sidvall.WorkItemManager.Data.IWorkItem.Worker
        {
            get
            {
                return this.Worker;
            }
            set
            {
                this.Worker = (Worker)value;
            }
        }
        global::Sidvall.WorkItemManager.Data.IWorkItemType global::Sidvall.WorkItemManager.Data.IWorkItem.WorkItemType
        {
            get
            {
                return this.WorkItemType;
            }
            set
            {
                this.WorkItemType = (WorkItemType)value;
            }
        }
        global::Sidvall.WorkItemManager.Data.IWorkRetryPolicy global::Sidvall.WorkItemManager.Data.IWorkItem.WorkRetryPolicy
        {
            get
            {
                return this.WorkRetryPolicy;
            }
            set
            {
                this.WorkRetryPolicy = (WorkRetryPolicy)value;
            }
        }
        System.Collections.Generic.IEnumerable<global::Sidvall.WorkItemManager.Data.IWorkItemLog> global::Sidvall.WorkItemManager.Data.IWorkItem.WorkItemLogs
        {
            get
            {
                if (this.WorkItemLogs != null)
                    return this.WorkItemLogs.Items;
                return null;
            }
        }
        void global::Sidvall.WorkItemManager.Data.IWorkItem.SetWorkItemLogs(Sidvall.Data.IDataRowProvider<global::Sidvall.WorkItemManager.Data.IWorkItemLog> items)
        {
            this.WorkItemLogs = (WorkItemLogCollectionItem)items;
        }
        System.Collections.Generic.IEnumerable<global::Sidvall.WorkItemManager.Data.IWorkItemSensor> global::Sidvall.WorkItemManager.Data.IWorkItem.WorkItemSensors
        {
            get
            {
                if (this.WorkItemSensors != null)
                    return this.WorkItemSensors.Items;
                return null;
            }
        }
        void global::Sidvall.WorkItemManager.Data.IWorkItem.SetWorkItemSensors(Sidvall.Data.IDataRowProvider<global::Sidvall.WorkItemManager.Data.IWorkItemSensor> items)
        {
            this.WorkItemSensors = (WorkItemSensorCollectionItem)items;
        }
        System.Collections.Generic.IEnumerable<global::Sidvall.WorkItemManager.Data.IWorkItemWorkCondition> global::Sidvall.WorkItemManager.Data.IWorkItem.WorkItemWorkConditions
        {
            get
            {
                if (this.WorkItemWorkConditions != null)
                    return this.WorkItemWorkConditions.Items;
                return null;
            }
        }
        void global::Sidvall.WorkItemManager.Data.IWorkItem.SetWorkItemWorkConditions(Sidvall.Data.IDataRowProvider<global::Sidvall.WorkItemManager.Data.IWorkItemWorkCondition> items)
        {
            this.WorkItemWorkConditions = (WorkItemWorkConditionCollectionItem)items;
        }

        #endregion

        #endregion
        #region Constructors

        public WorkItem()
        {
        }
        public WorkItem(bool initializeDefaultValues)
            : this(initializeDefaultValues, null, Sidvall.Business.BusinessEvents.None)
        {
        }
        public WorkItem(bool initializeDefaultValues, Sidvall.Data.DataRowState? dataRowState, Sidvall.Business.BusinessEvents enabledBusinessEvents)
            : base(dataRowState, enabledBusinessEvents)
        {
            if (initializeDefaultValues)
                global::Sidvall.WorkItemManager.SystemContext.Current.EntityFacade.WorkItemManager.Initialize(this);
        }

        #endregion
    }
}